package com.bjsxt.livegoods.search.client.controller;

import com.bjsxt.livegoods.search.client.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 搜索服务消费者 --控制器
 */

@RestController
public class SearchController {

    @Autowired
    private SearchService searchService;
    @GetMapping
    @CrossOrigin
    public Map<String,Object> searchProduct(String city, String content,
                                            int page,
                                            @RequestParam(value="rows",defaultValue = "3") int rows){
       return searchService.searchProducts(city,content,page,rows);
    }
}
